package com.wcs.exam.common.server.upload;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.Collection;

/**
 * 上传功能
 *
 * @author wcs
 */
public interface UploadFace {

    /**
     * 图片上传
     *
     * @return 图片url
     */
    String uploadPic(MultipartFile file, Upload upload);

    /**
     * 图片Base64字符串上传
     *
     * @param imgBase64 图片Base64字符串
     * @param upload    上传配置
     * @return 图片地址
     */
    String uploadPicBase64(String imgBase64, Upload upload);

    /**
     * 图片Base64字符串上传
     *
     * @param imgBase64 图片Base64字符串
     * @param fileName  文件名称
     * @param upload    上传配置
     * @return 图片地址
     */
    String uploadPicBase64(String imgBase64, String fileName, Upload upload);

    /**
     * 文档上传
     *
     * @return 文档url
     */
    String uploadDoc(MultipartFile file, Upload upload, Boolean isPublicRead);


    /**
     * 文档上传
     *
     * @return 文档url
     */
    String uploadDoc(File file, String fileName, Upload upload, Boolean isPublicRead);


    /**
     * 删除文档
     *
     * @param fileUrl 删除文件地址
     * @param upload  上传配置
     */
    void delete(String fileUrl, Upload upload);


    /**
     * 删除文档
     *
     * @param fileUrls 删除文件地址
     * @param upload   上传配置
     */
    void delete(Collection<String> fileUrls, Upload upload);


    /**
     * 获取下载地址
     */
    String getDownloadUrl(String docUrl, int expireSeconds, Upload upload);

    /**
     * 获取预览地址
     *
     * @return 预览地址
     */
    String getPreviewConfig(String docUrl, int expireSeconds, Upload upload);

}
